﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace 相机模块案例01
{
    public class CameraFactory
    {
        public ICamera CreateCamera(string cameraType, string connectionType)
        {
            IConnection connection = null;
            switch (connectionType)
            {
                case "UDP":
                    connection = new UDPHelper();
                    break;
                case "TCP":
                    connection = new TCPHelper();
                    break;
                default:
                    break;
            }
            ICamera camera = null;
            switch (cameraType)
            {
                case "A":
                    camera = new CameraA(connection);
                    break;
                case "B":
                    camera = new CameraB(connection);
                    break;
                default:
                    break;
            }
            return camera;
        }
    }
}
